home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-24 | 2.6 KB | 65 lines | [TEXT/GEOL] |
- Item forwarded by A33 to A34
-
- Item 8795939 19-Nov-89 02:50
-
- From: UK0310 Paul G Smith
-
- To: MACAPP.TECH$ MacApp Technical
-
- cc: SHEBANOW1 Shebanow, Andrew
-
- Sub: C++ for systems programming
-
- Use of C++ for stand-alone code resources...
-
- (This message would have been posted to CPlus.Tech$ if that list was active
- yet. It isn't, as far as I know, and MacApp.Tech$ seems the next best!)
-
-
- I figured it would be pretty neat to be able to produce stand-alone code
- resources using MPW C++. I'd always wanted to do it with Object Pascal and it
- seemed like C++ would allow me do develop low level stuff using OOP principles.
- So, I set about building a generic OOP shell for certain kinds of stand-alone
- code resource, using MPW C++.
-
- Almost immediately I ran up against some problems that I should have been able
- to predict before I started. However, it would be nice to know if there is any
- way around these problems, because C++ is such an ideal language for systems
- programming and it really is about time such work could be done the OOP way.
-
- C++ can be used to build stand-alone code resources if the following three
- restrictions are noted:
-
- {i} You cannot use anything except stack allocated objects. For instance, if
- you try to use new to create an object, the linker complains because the data
- initialisation code is not being called.
-
- {ii} You cannot define or use constructors or destructors. If you do, the
- linker complains as in {i} above.
-
- {iii} You cannot use virtual member functions. If you do, the linker complains
- as in {i} & {ii} above.
-
- The is all very well, but it means that you can only have one level of objects,
- that you can't allocate them in the heap, and that the expressiveness of C++ is
- lost.
-
- The thing is, I don't see that we are talking about inherent limitations of C++
- here. There is no reason, other than implementation decisions relating to the
- MPW version of C++, why one should not be able to build stand-alone code
- resources using the full expressiveness of C++. It strikes me that if this
- limitation was removed one could also develop for the MCP (and other 68K
- platforms) using C++.
-
- So, my question is:
-
- What can I do to force *all* the output - including constrctors, destructors,
- and all the other run-time support code - of the MPW C++ compilation system to
- end up in the *same* segment and to ensure that all the right code gets called.
- I am quite happy to build the necessary support routines (and publish them in
- due course), but I can't until I know what to do. Can anyone help??
-
- Regards, Paul
-
-
-